package org.example.product.controller;
import org.example.product.entity.ResultBody;
import org.example.product.service.GoodsMesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
@RestController
@RequestMapping("/GoodMessage")
@CrossOrigin(origins = "*")
//查看详细商品信息（用户）
public class GoodsMesController {
    @Autowired
    private GoodsMesService goodsMesService;
    @RequestMapping("/goodMessage")
    public ResultBody goodMessage(@RequestBody Map<String,Object> map){
        //参数完整判断
        if(map.get("code")==null){
            return new ResultBody(404,"缺少参数",false);
        }//传商品编号
        String code = map.get("code").toString();
        //进行传值
        return goodsMesService.GoodsMessage(code);
    }
    @RequestMapping("/displayComment")
    public ResultBody displayComment(@RequestBody Map<String,Object> map){
        //参数完整判断
        if(map.get("code")==null){
            return new ResultBody(404,"缺少参数",false);
        }//传商品编号
        String code = map.get("code").toString();
        //进行传值
        return goodsMesService.displayComment(code);
    }
}
